@extends('layout.admin.index')
<?php  $left_selected ="权限管理"; $center_selected = "管理员显示"?>
@section('main')

  
<div class="mws-panel grid_8">
	<div class="mws-panel-header">
    	<span>
    		<i class="icon-user"></i>管理员显示
    	 <button class="btn btn-sm btn-primary" onclick="window.location='{{route('admin.edit')}}'">添加管理员</button>
    	</span>

    </div>


    <div class="mws-panel-body no-padding">
       		 
	        <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
	            <thead>
	                <tr role="row" style="height:80px">
	                <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 6px;" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">ID</th>
	                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 55px;" aria-label="Browser: activate to sort column ascending">用户名</th>
	                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 50px;" aria-label="Browser: activate to sort column ascending">邮箱</th>
	                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 35px;" aria-label="Browser: activate to sort column ascending">添加时间</th>
	                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 35px;" aria-label="Browser: activate to sort column ascending">最后修改时间</th>
	                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 80px;" aria-label="CSS grade: activate to sort column ascending">操作</th></tr>
	            </thead>
		        <tbody role="alert" aria-live="polite" aria-relevant="all">
		         @foreach($user as $k => $v)
	 			 <tr class=" {{$k%2==0?'odd':'even'}}">
				    <td class="id" class="sorting_1">{{ $v->id }}</td>
				    <td class=" ">{{ $v->username }}</td>
				    <td class=" ">{{ $v->email }}</td>
					<td class=" ">{{ $v->addtime }}</td>
					<td class=" ">{{ $v->lasttime }}</td>
				    <td class=" "><a id ="sure" onclick="doDel('{{ route('admin.del',['id'=>$v->id])}}')">删除</a> |
				    <a href="{{route('admin.edit',['id' =>$v->id])}}">编辑</a> |
				    <a href="{{route('distri.loadRole',['id'=>$v->id])}}">分配角色</a></td>
				 </tr>
				@endforeach
				</tbody>
			</table>

			<form id ="myform"  action="route('admin.del',['id'=>$v->id])" method="post" name="myform" style="display:none">
				<input type="hidden" name="_token" value="{{ csrf_token() }}">
				<input type="hidden" name="_method" value="delete">
			</form>
			
		</div>
    </div>
</div>
         
     <script type="text/javascript">

	function doDel(url){
	    if(confirm("确定要删除吗？")){
			$('#myform').attr('action',url);
			$('#myform').submit();
	    }
	}
         
 </script>

@endsection


